%define commit f09a245221f95eb7acce1f3a2d8f3e3f41b80d01
%define commit_short %(echo %{commit} | head -c6)

Summary:	Promethean panel management tool
Summary(ru_RU.UTF-8): Управление панелью Promethean
Name:		panel-management
Version:	1.1
Release:	1.git%{commit_short}.2
License:	GPLv3
Group:		System/Configuration/Other
Url:		https://hub.mos.ru/mos/pkgs/panel-management
Source0:	https://hub.mos.ru/mos/pkgs/panel-management/-/archive/%{commit}/%{name}-%{commit}.tar.gz

Requires:	python3-qtpy
BuildArch:	noarch

%description
Allows managing Promethean panel with GUI

%description -l ru_RU.UTF-8
Позволяет управлять панелью Promethean при помощи пользовательского интерфейса

%files
%doc README.md
%dir %{_libexecdir}/%{name}
%{_libexecdir}/%{name}/%{name}.py
%{_libexecdir}/%{name}/commands
%{_datadir}/applications/panel-management.desktop
%{_libexecdir}/%{name}/__pycache__
%{_bindir}/%{name}
%{python3_sitelib}/panel_management_modules
%{_iconsdir}/hicolor/scalable/apps/%{name}.svg

#------------------------------------------------------------------

%prep
%autosetup -p1 -n %{name}-%{commit}

%build

%install
mkdir -p %{buildroot}%{_libexecdir}/%{name}
install -m755 %{name}.py %{buildroot}%{_libexecdir}/%{name}
install -m644 commands %{buildroot}%{_libexecdir}/%{name}

mkdir -p %{buildroot}%{python3_sitelib}/panel_management_modules
install -m644 panel_management_modules/* %{buildroot}%{python3_sitelib}/panel_management_modules

mkdir -p %{buildroot}%{_bindir}
cat << EOF > %{buildroot}%{_bindir}/%{name}
#!/bin/sh
cd %{_libexecdir}/%{name}
%{_libexecdir}/%{name}/%{name}.py "\$@"
EOF
chmod +x %{buildroot}%{_bindir}/%{name}

mkdir -p %{buildroot}%{_datadir}/applications
install -m644 panel-management.desktop %{buildroot}%{_datadir}/applications/panel-management.desktop

mkdir -p %{buildroot}%{_iconsdir}/hicolor/scalable/apps
install -m644 %{name}.svg %{buildroot}%{_iconsdir}/hicolor/scalable/apps
